﻿using Model;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Utilities;

namespace Business
{
    public class SynchronousDingTalk
    {
        public static void Synchronous()
        {
            LogHelper log = LogFactory.GetLogger("Synchronous");
            try
            {
                Stopwatch watch = CommonHelper.TimerStart();

                Console.Write("\n导入到钉钉组织框架");
                #region 查出目前新增的部门，导入到钉钉组织框架
                DepartmentForDingTalkBll.InsertDepartmentForDingTalk();
                //DepartmentForDingTalkBll.DeleteDepartment();
                #endregion

                Console.Write("\n导入人员信息到钉钉");
                #region 查出目前新增的人员，导入到钉钉组织框架
                EmployeeForDingTalkBll.EmployeeInsertForDingTalk();
                #endregion

                log.Info("\n钉钉接口同步对接成功，共耗时：" + CommonHelper.TimerEnd(watch) + "毫秒\n");

                Console.Write("\n钉钉接口同步对接成功，共耗时：" + CommonHelper.TimerEnd(watch) + "毫秒\n");

            }
            catch (Exception ex)
            {
                log.Error("\r\n SynchronousDingTalk-Synchronous()" + ex);
                //Console.Write(ex.Message);
            }
        }
    }
}
